﻿using Mes.Application.DTO.Inputs.Quality;
using Microsoft.EntityFrameworkCore.ValueGeneration.Internal;

namespace Mes.Application.DTO.Results.Quality
{
    public class QmSpecResult : QmSpecCommon
    {
        /// <summary>
        /// 质量规格id
        /// </summary>
        public int Qm_Spec_Id { get; set; } = 0;

        /// <summary>
        /// 生产单元名称
        /// </summary>
        public string ProductionUnitName { get; set; } = string.Empty;

        /// <summary>
        /// 生产单元编码
        /// </summary>
        public string ProductionUnitCode { get; set; } = string.Empty;

        /// <summary>
        /// 采样计划名称
        /// </summary>
        public string Plan_Name { get; set; } = string.Empty;

        /// <summary>
        /// 采样计划描述
        /// </summary>
        public string? Plan_Desc { get; set; } = null;

        /// <summary>
        /// 采样名称
        /// </summary>
        public string? Sample_Name { get; set; } = null;

        /// <summary>
        /// 质量规格链接的特性
        /// </summary>
        public List<QmSpecCharacteristicResult> QmSpecChars { get; set; }

        /// <summary>
        /// Spc规则列表
        /// </summary>

        public List<SpcRuleResult> SpcRules { get; set; }
    }

    public class QmSpecCharacteristicResult : QmSpecCharacteristic
    {
        public QmSpecCharacteristicResult() { }

        public QmSpecCharacteristicResult(int charId, string charName, string? charDesc, double target, double? usv, double? lsv)
        {
            CharacteristicId = charId;
            Char_Name = charName;
            Char_Desc = charDesc;
            Target = target;
            Usv = usv;
            Lsv = lsv;
        }

        /// <summary>
        /// 特征名称
        /// </summary>
        public string Char_Name { get; set; } = string.Empty;

        /// <summary>
        /// 特征描述
        /// </summary>
        public string? Char_Desc { get; set; } = null;
    }
}
